//
//  SSBaseNavigationController.m
//  starspaceVR
//
//  Created by 曹端芹 on 17/9/12.
//  Copyright © 2017年 starspace. All rights reserved.
//

#import "SSBaseNavigationController.h"

@interface SSBaseNavigationController ()

@end

@implementation SSBaseNavigationController


+ (void)initialize {
    
    [[UINavigationBar appearance] setTranslucent:NO];
    [UINavigationBar appearance].barTintColor = [UIColor whiteColor];
    
    UINavigationBar *item = [UINavigationBar appearance];
    
    NSMutableDictionary *atts = [NSMutableDictionary dictionary];
    atts[NSFontAttributeName] = kFont(17);
    atts[NSForegroundColorAttributeName] = [UIColor redColor];
    
    [item setTitleTextAttributes:atts];


}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    if (self.viewControllers.count == 0) {
        
    }else{
        UIButton *back = [UIButton buttonWithType:UIButtonTypeCustom];
        back.frame = CGRectMake(0, 0, 20, 20);
        [back setBackgroundImage:[UIImage imageNamed:@"nav_back"] forState:UIControlStateNormal];
        back.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        UIBarButtonItem *leftBack = [[UIBarButtonItem alloc] initWithCustomView:back];
        [back addTarget:self action:@selector(popViewControllerAnimated:) forControlEvents:UIControlEventTouchUpInside];
        UIBarButtonItem *spaceItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
        spaceItem.width = -10;
        viewController.navigationItem.leftBarButtonItems = @[spaceItem,leftBack];
        self.interactivePopGestureRecognizer.delegate = nil;
        viewController.hidesBottomBarWhenPushed = YES;
    }

    [super pushViewController:viewController animated:animated];
    
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
